package com.zzyl.controller;

import com.zzyl.base.ResponseResult;
import com.zzyl.dto.DeviceDetailDTO;
import com.zzyl.dto.DeviceDto;
import com.zzyl.dto.QueryIotProductPageDTO;
import com.zzyl.service.IotService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/iot")
public class IotController {

    @Resource
    private IotService iotService;
    @PostMapping("/QueryProductList")
    public ResponseResult getProductInfo(@RequestBody QueryIotProductPageDTO dto){
        return iotService.getProductInfo(dto);
    }

    /**
     * 注册单个设备
     * @param deviceDto
     * @return
     * @throws Exception
     */
    @PostMapping("/RegisterDevice")
    public ResponseResult registerDevice(@RequestBody DeviceDto deviceDto){
        return iotService.registerDevice(deviceDto);
    }

    /**
     * 分页查询全部设备
     * @param dto
     * @return
     */
    @PostMapping("/QueryDevice")
    public ResponseResult queryDevice(@RequestBody QueryIotProductPageDTO dto){
        return iotService.queryDevice(dto);
    }

    /**
     * 查询设备的详细信息
     * @param dto
     * @return
     */
    @PostMapping("/QueryDeviceDetail")
    public ResponseResult queryDeviceDetail(@RequestBody DeviceDetailDTO dto){
        return iotService.queryDeviceDetail(dto);
    }

    /**
     * 查询物模型功能列表
     * @param dto
     * @return
     */
    @PostMapping("/QueryThingModelPublished")
    public ResponseResult queryThingModelPublished(@RequestBody DeviceDetailDTO dto){
        return iotService.queryThingModelPublished(dto);
    }

    /**
     * 查询设备的状态
     * @param dto
     * @return
     */
    @PostMapping("/QueryDevicePropertyStatus")
    public ResponseResult queryDevicePropertyStatus(@RequestBody DeviceDto dto){
        return iotService.queryDevicePropertyStatus(dto);
    }

    /**
     * 修改设备
     * @param dto
     * @return
     */
    @PostMapping("/UpdateDevice")
    public ResponseResult updateDevice(@RequestBody DeviceDto dto){
        return iotService.updateDevice(dto);
    }

    /**
     * 删除设备
     * @param dto
     * @return
     */
    @DeleteMapping("/DeleteDevice")
    public ResponseResult deleteDevice(@RequestBody DeviceDetailDTO dto){
        return iotService.deleteDevice(dto);
    }


}
